#ifndef ENGINE_AUDIO_H                // Prevent multiple definitions if this 
#define ENGINE_AUDIO_H                // file is included in more than one place
#include <apoget.h>

class Audio;
#define XMA2DEFS_ASSERT(a)
#include <xact3.h>

class Audio
{
	Audio() {}
	Audio(const Audio&);
	Audio& operator=(const Audio&);
	static Audio theInstance;

    // properties
  private:
    IXACT3Engine* xactEngine;   // pointer to XACT sound engine
    IXACT3WaveBank* waveBank;   // pointer to XACT wave bank
    IXACT3SoundBank* soundBank; // pointer to XACT sound bank
    XACTINDEX cueI;             // XACT sound index
    void* mapWaveBank;          // call UnmapViewOfFile() to release file
    void* soundBankData;
    bool coInitialized;         // set true if coInitialize is successful
	void init();

  public:
	  static Audio& getInstance();

    // Destructor
    virtual ~Audio();

    // member functions

    // Initialize Audio
    HRESULT initialize(const char* waveBankFile=NULL, const char* soundBankFile=NULL);
	bool shutdown() { return true;  }

    // Perform periodic sound engine tasks.
    void run();

    // Play sound specified by cue from sound bank.
    // If cue does not exist no error occurs, there is simply no sound played.
    void playCue(const char cue[]);

    // Stop a playing sound specified by cue from sound bank.
    // If cue does not exist no error occurs.
    void stopCue(const char cue[]);
};
#define gAudio Audio::getInstance()
#endif
